import Api from '@/api/server/member'
import i18n from "@/lang/index";
const contentConfig = {
  pageName: "sys:user",
  table: {
    border: true,
    highlightCurrentRow: false,
  },
  // defSearch: false,
  indexAction: (data) => {
    console.log("分页", data);
    return new Promise((resolve, reject) => {
      Api.getList(data).then((res) => {
        console.log("获取接口数据===>",res);
        resolve(res)
      }).catch(e => {
        console.log(e);
        reject(e)
      })
    });
  },
  deleteAction: function (id) {
    console.log("delete", id);
    return new Promise((resolve, reject) => {
      Api.del({ id }).then(s => {
        resolve({
          code: "00000",
          data: null,
          msg: i18n.global.t("hint.7"),
        })
      }).catch(e => {
        reject(e)
      })

    });
  },
  exportAction: function (queryParams) {
    // 导出Excel文件
    // return exportUser(queryParams);
  },
  pk: "id",
  toolbar: [
    "refresh",
    "add",
    // "delete",
    // "export",
    {
      name: "groupMessagesStatus",
      icon: "EditPen",
      text: i18n.global.t('label.175'),
      auth: "",
    },
  ],
  cols: [
    { type: "selection", width: 50, align: "center",fixed: "left" },
    { label: i18n.global.t('label.15'), align: "center", prop: "user.id" },
    { label: i18n.global.t('label.9'), align: "center", prop: "user.username",minWidth: 150 },
    { label: i18n.global.t('label.45'), align: "center", templet: 'custom', prop: "role" ,minWidth: 150},
    { label: i18n.global.t('label.18'), align: "center", templet: 'custom', prop: "is_test" ,minWidth: 150},
    { label: i18n.global.t('label.154'), align: "center", prop: "conversation_id", minWidth: 150},
    { label: i18n.global.t('label.157'), align: "center", templet: 'custom', prop: "can_send_group_messages", minWidth: 160},
    { label: i18n.global.t('label.156'), align: "center",templet: 'custom',  prop: "can_message_participants", minWidth: 160},
    { label: i18n.global.t('label.155'), align: "center",templet: 'custom',  prop: "is_banned", minWidth: 150},
    { label: i18n.global.t('label.14'), align: "center", prop: "note", minWidth: 150},
    { label: i18n.global.t('label.38'), align: "center", type: "time", prop: "created_at", minWidth: 180 },
    { label: i18n.global.t('label.133'), align: "center", type: "time", prop: "updated_at", minWidth: 180 },
    {
      label: i18n.global.t("label.8"),
      fixed: "right",
      width: 220,
      align: "center",
      templet: "tool",
      operat: [
        'edit',
        'delete'
      ],
    },
  ],
};

export default contentConfig;
